#include "SkyManager.h"

// 
// SkyManager::~SkyManager( void )
// {
// 	if (m_CaelumSystem)
// 	{
// 		m_CaelumSystem->shutdown(false);
// 		m_CaelumSystem = NULL;
// 	}
// }



bool SkyManager::Init( Ogre::Camera* camera )
{
	// Create SkyX
	m_Sky = new SkyX::SkyX(m_Smgr, camera);
	m_Sky->create();

	// Add our ground atmospheric scattering pass to terrain material
// 	m_Sky->getGPUManager()->addGroundPass(
// 		static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().
// 		getByName("Terrain"))->getTechnique(0)->createPass(), 5000, Ogre::SBT_TRANSPARENT_COLOUR);

	// Create our terrain
	//mSceneMgr->setWorldGeometry("Terrain.cfg");

	// Add a basic cloud layer
	m_Sky->getCloudsManager()->add(SkyX::CloudLayer::Options(/* Default options */));

	return true;
}


void SkyManager::setTimeMultiplier( float t )
{
	m_Sky->setTimeMultiplier(t);
}

void SkyManager::Updata( float timeSinceLastFrame )
{
	m_Sky->update(timeSinceLastFrame);  
}
